// 皮肤类型
export const filterSkinType = (params) => {
    let name = ''
    switch (params.type) {
        case 1:
            name = '原型'
            break
        case 2:
            name = '史诗'
            break
        case 3:
            name = '传说'
            break
        case 4:
            name = '周年限定'
            break
        case 5:
            name = '经典'
            break
        case 6:
            name = '中秋限定'
            break
        case 7:
            name = '春节限定'
            break
        case 8:
            name = '圣诞限定'
            break
        case 9:
            name = '青春校园'
            break
        case 11:
            name = '周年限定'
            break
        case 12:
            name = '周年限定'
            break
        case 13:
            name = '异元时空'
            break
        case 14:
            name = '神话'
            break
        case 15:
            name = '赛季限定'
            break
        case 16:
            name = '古堡晚宴'
            break
        case 18:
            name = '限定'
            break
        default:
            name = '未知'
    }
    return name
}

const kindType = (type) => {
    let config = {}
    switch (type) {
        case '0':
            config.name = 'pve'
            config.bgColor = '#e54d42'
            config.textColor = '#fff'
            break
        case '1':
            config.name = '强攻'
            config.bgColor = '#f37b1d'
            config.textColor = '#fff'
            break
        case '2':
            config.name = '护盾'
            config.bgColor = '#fbbd08'
            config.textColor = '#fff'
            break
        case '3':
            config.name = '减伤'
            config.bgColor = '#8dc63f'
            config.textColor = '#fff'
            break
        case '4':
            config.name = '辅助'
            config.bgColor = '#e54d42'
            config.textColor = '#fff'
            break
        case '5':
            config.name = '恢复'
            config.bgColor = '#39b54a'
            config.textColor = '#fff'
            break
        case '6':
            config.name = '免伤'
            config.bgColor = '#1cbbb4'
            config.textColor = '#fff'
            break
        case '7':
            config.name = '免疫异常'
            config.bgColor = '#0081ff'
            config.textColor = '#fff'
            break
        case '8':
            config.name = '消回合'
            config.bgColor = '#6739b6'
            config.textColor = '#fff'
            break
        case '9':
            config.name = '先制'
            config.bgColor = '#9c26b0'
            config.textColor = '#fff'
            break
        case '10':
            config.name = '控制'
            config.bgColor = '#e03997'
            config.textColor = '#fff'
            break
        case '11':
            config.name = '强化'
            config.bgColor = '#a5673f'
            config.textColor = '#fff'
            break
        case '12':
            config.name = '弱化'
            config.bgColor = '#8799a3'
            config.textColor = '#fff'
            break
        case '13':
            config.name = '封属'
            config.bgColor = '#fadbd9'
            config.textColor = '#e54d42'
            break
        case '14':
            config.name = '固伤'
            config.bgColor = '#fde6d2'
            config.textColor = '#f37b1d'
            break
        case '15':
            config.name = '减pp'
            config.bgColor = '#fef2ced2'
            config.textColor = '#fbbd08'
            break
        case '16':
            config.name = '护罩'
            config.bgColor = '#e8f4d9'
            config.textColor = '#8dc63f'
            break
        case '17':
            config.name = '闪避'
            config.bgColor = '#d7f0dbff'
            config.textColor = '#39b54a'
            break
        case '18':
            config.name = '干扰'
            config.bgColor = '#d2f1f0'
            config.textColor = '#1cbbb4'
            break
    }
    return config
}

// 精灵/魂印 定位
export const filterKind = (kind) => {
    kind = kind.toString()
    kind = kind.split(' ')
    let data = []
    kind.forEach(item => {
        data.push(kindType(item))
    })
    return data
}

// 随机颜色
export const randomColor = () => {
    return '#' + Math.floor(Math.random() * 16777215).toString(16);
}

// 异常状态类型
export const abnormalTab = (tab) => {
    return tab === 1 ? '控制类' : tab === 2 ? '弱化类' : tab === 3 ? '附属类' : '其它'
}

// 计算种族值和
export const calcRace = (hp, atk, def, sp_atk, sp_def, spd) => {
    return hp + atk + def + sp_atk + sp_def + spd
}

// 属性
export const filterRestrain = (list = [], id) => {
    let name = ''
    let icon = ''
    list.forEach(item => {
        if (item.id === id) {
            name = item.cn
            icon = item.icon
        }
    })
    return {
        name,
        icon
    }
}


export default {
    filterSkinType,
    filterKind,
    randomColor,
    abnormalTab,
    calcRace,
    filterRestrain
}
